<template>
    <div>
        <h2>Home组件内容</h2>
        <div>
            <ul class="nav nav-tabs">
                <li>
                    <router-link class="list-group-item" active-class="active" to="/home/news">News</router-link>
                </li>
                <li>
                    <router-link class="list-group-item" active-class="active" to="/home/message">Message</router-link>
                </li>
            </ul>
            <!-- 路由内容展示区，使用keep-alive缓存路由组件 -->
            <!-- 其中include指定的想要缓存的路由，该值指定的就是组件的名称。 -->
            <keep-alive include="News">
                <router-view></router-view>
            </keep-alive>
        </div>
    </div>
</template>

<script>
    export default {
        name: 'Home',
        mounted() {
            console.log('Home 组件挂载完毕了');
            window.aboutRoute = this.$route;
            window.aboutRouter = this.$router;
        },
        beforeDestroy() {
            console.log('Home 组件即将被销毁了');
        },
    }
</script>

<style lang="css">

</style>